import time
from selenium import webdriver
from selenium.webdriver.common.by import By

# 获取驱动
dr = webdriver.Chrome()
# 打开百度
dr.get("https://www.baidu.com")
# 最大化网页
dr.maximize_window()
# 停留
time.sleep(3)
# 找到logo
e = dr.find_element(By.ID,"s_lg_img")
url = e.get_attribute("src")
print(url)
# 借助request
import requests
response = requests.get(url)
with open("1.png","wb+") as f:
    f.write(response.content)
# 使用截图方式保存
with open("2.png","wb+") as f:
    f.write(e.screenshot_as_png)